package com.vernhe;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @EnableEurekaClient Eureka客户端
 * @EnableDiscoveryClient 可以被发现
 * @RefreshScope 会重新刷新@ConfigurationProperties所绑定的值。在此类中会重新更新value的值
 *
 * @author Administrator
 */
@SpringBootApplication
@RestController
@EnableEurekaClient
@EnableDiscoveryClient
@RefreshScope
public class Application {

    @Value("${test.value}")
    private String value;

    @RequestMapping("/")
    public String home() {
        return this.value;
    }

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

}